<template>
  <div>
    <h3>Search Github Users</h3>
    <input type="text" placeholder="enter the name your search" v-model="keyword">
    <button @click="searchUsers">Search</button>
  </div>
</template>

<script>
export default {
  name: 'my-search',
  data() {
    return {
      keyword: ''
    }
  },
  methods: {
    searchUsers() {
      this.$http.get(`https://api.github.com/search/users?q=${this.keyword}`)
      .then(response => this.$bus.$emit('usersList', response.data.items))
      .catch(function (error) {
        console.log(error.message);
      })
    }
  }
}
</script>